﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using UniversalBlazor.Abstract;
using UniversalBlazor.CoreComponent;

namespace UniversalBlazor.ElementUI
{
    public class ComponentConfig : IComponentConfig
    {
        public string CSS { get; } = "https://unpkg.com/element-ui/lib/theme-chalk/index.css";

        public IDictionary<string, Type> TargetComponents { get; } = new Dictionary<string, Type>();

        public ComponentConfig(Assembly assmebly)
        {
            var types = assmebly.GetExportedTypes().Where(x => x.IsSubclassOf(typeof(UComponent))).ToArray();
            foreach (var type in types)
            {
                TargetComponents.Add($"U{type.Name}", type);
            }
        }
    }
}
